package com.hqyj.bigdata.hiveproject.controller;

import com.hqyj.bigdata.hiveproject.entity.TopTenVideoInfo;
import com.hqyj.bigdata.hiveproject.json.R;
import com.hqyj.bigdata.hiveproject.service.TopTenVideoInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("video")
@RestController
public class TopTenVideoInfoController {

    @Resource
    private TopTenVideoInfoService topTenVideoInfoService;


    @GetMapping("topTen")
    public R queryTopTenVideoInfoList(){
        try{

           List<TopTenVideoInfo> topTenVideoInfoList = topTenVideoInfoService.queryTopTenVideoInfoList();
           return R.success("查询视频播放量前十名列表成功！",topTenVideoInfoList);
        }catch (Exception ex){
            ex.printStackTrace();
            return R.error("程序出现异常！");
        }
    }
}
